<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>reflect的基本使用</title>
</head>

<body>
    <script>
        const user = { name: 'tom', age: 20 }
        console.log(user)
        console.log(Reflect.get(user, 'name')) // 直接打印输出使用Reflect获取的属性值
        console.log(Reflect.get(user, 'age'))
        Reflect.set(user, 'name', 'jerry')
        Reflect.set(user, 'age', 26)
        Reflect.set(user, 'score', 99)
        console.log(user)
    </script>
</body>

</html>